{template Public:Admin:header}

<div class="row"> 
		<div class="col-lg-11 col-lg-offset-1"> 
        	<div class="row"> <h3>服务ID: {echo $id}</h3></div>
			{template Fuwu:Publish:form}
		</div>
</div>
	
    <script>							
        $(function(){
            
                     var um = UM.getEditor('Content');
                     
                     um.addListener("contentChange",function(){
                        if(UM.getEditor('Content').hasContents()){
                            $('#FuwuForm button[type="submit"]').attr('disabled',false);
                        }
                     });
                      
                     $("#FuwuCategory").click( function () { $('#FuwuForm button[type="submit"]').attr('disabled',false); }); 
                        
                    //分类
                  SetFormCategory(AURL+"/js/foxphp_json_fuwu_category.js",'#FuwuCategory');
        
                  $('#FuwuForm').bootstrapValidator({
                        excluded: [':disabled'],
                        feedbackIcons: {
                            valid: 'glyphicon glyphicon-ok',
                            invalid: 'glyphicon glyphicon-remove',
                            validating: 'glyphicon glyphicon-refresh'
                        },
                        fields: {
                            subject: {
                                validators: {
                                    notEmpty: {
                                        message: '服务标题不能为空！'
                                    },
                                    stringLength: {
                                        min: 5,
                                        max: 100,
                                        message: '标题最少5个字到100字内！'
                                    }
                                }
                            },
                            money: {
                                validators: {
                                    notEmpty: {
                                        message: '报价不能为空！'
                                    },
                                    regexp: {
                                        regexp: /^[0-9]+$/,
                                        message: '报价格式有误！'
                                    }
                                }
                            },
                            endtime: {
                                validators: {
                                    notEmpty: {
                                        message: '周期不能为空！'
                                    },
                                    regexp: {
                                        regexp: /^[0-9]+$/,
                                        message: '周期格式有误！'
                                    }
                                }
                            }
                            
                        },
                        submitHandler: function (form) {
                            
                            var catid=$("#Catid").val();
                            if(catid<1){
                                 bootbox.alert({ 
                                    size: 'small',
                                    message: "请选择服务分类！"
                                })
                                 return false; 
                             }
                                             
                         if(!UM.getEditor('Content').hasContents()){
                             bootbox.alert({ 
                                size: 'small',
                                message: "请填写服务需求！"
                             })
                             return false; 
                         }
                                             
                          $.post('/admin/fuwu/edit/id/{echo $id}',$("#FuwuForm").serialize(), function(json) {
                            
                                $('.bootbox').PhpappProgress({json:json});
        
                                return true;
                            
                          }, 'json');
                          
        
                         bootbox.dialog({
                             message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
                             title: '<i class="icon fa fa-retweet"></i> 提交中',
                             closeButton: false
                         }).PhpappProgress({time:2000});
                     
                          return false; 
                         
                        } 
                    
                    }) 
        
                });
               
        
        </script>

    
{template Public:Admin:footer}